package com.yy.sso.gateway.com.yy.sso.gatweway.config;

import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.web.server.SecurityWebFilterChain;

@EnableWebFluxSecurity
public class WebSecurityConfig {

    @Bean
    SecurityWebFilterChain webFluxSecurityFilterChain(ServerHttpSecurity http) {

        http.authorizeExchange().pathMatchers("/actuator/**").hasRole("admin")
                .anyExchange().permitAll().and().cors().and()
                .httpBasic().and()
                .csrf().disable();
        return http.build();
    }
}